<%-- 
    Document   : searchProduct
    Created on : Dec 17, 2009, 10:46:13 PM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<div>
    <form method="get">
        <table border="1">
            <tr><td>Search for: </td><td><input type="text" name="q" value="${keyword}"/></td><td><input type="submit" value="Search"/></td></tr>
        </table>
    </form>
    <div>${msg}</div>
    <c:if test="${productsCount>0}">
        <table border="1">
            <tr>
                <th>#</th><th>Name</th><th>Code</th><th>Selling price</th><th>Available quantity</th>
            </tr>

            <c:forEach var="product" items="${products}" varStatus="counter">
                <tr><td>${counter.count}</td>
                    <td><a href="<%=request.getContextPath()%>/product/view?id=${product.autoId}">${product.name}</a></td>
                    <td>${product.code}</td>
                    <td>${product.currentSellingPrice} VND</td>
                    <td>${product.totalAvailable}</td>
                    <td>
                        <a href="<%=request.getContextPath()%>/product/edit?id=${product.autoId}">Edit</a>
                    </td>
                    <td><a href="<%=request.getContextPath()%>/product/purchase?pid=${product.autoId}">Add purchase</a></td></tr>
                </c:forEach>
        </table>
    </c:if>
</div>
